package com.ycd.fegin;


import com.ycd.fallback.MovieFeignServiceFallbackFatory;
import com.ycd.result.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

//,
@FeignClient(value = "service-movie",fallbackFactory = MovieFeignServiceFallbackFatory.class) // 指定需要调用的服务的应用名称
@RequestMapping("/movieTicket")
public interface MovieFeignClient {

    /**
     * 查询所有对象-电影票查询：查询所有电影票信息并返回
     */
    @RequestMapping(value = "/list",method = RequestMethod.GET)
    JsonResult list();

    /**
     * 根据id买票同时，保存用户、电影票中间表 -涉及两张表
     */
    @GetMapping("/buyTicket/{userId}/{movieId}")
    JsonResult buyTicket(@PathVariable("userId") Long userId,@PathVariable("movieId") Long movieId);

    /**
     * 根据电影Id，查询用户是否拥有此电影票
     */
    @GetMapping("/watchMovie/{userId}/{movieId}")
    JsonResult watchMovie(@PathVariable("userId") Long userId,@PathVariable("movieId") Long movieId);

}